﻿using UnityEngine;
using System.Collections;

namespace IMIForUnity
{

    /// <summary>
    /// Safely print log in the main thread
    /// </summary>
    public class Log
    {
        private static MainThreadDispatcher mainThreadDispatcher = MainThreadDispatcher.GetInstance();
        private static string TAG = "ImiUnityLog: ";


        public static void d(object message)
        {
            if (mainThreadDispatcher != null)
            {
                mainThreadDispatcher.Enqueue(() => Debug.Log(TAG + message));
            }
        }

        public static void e(object message)
        {
            if (mainThreadDispatcher != null)
            {
                mainThreadDispatcher.Enqueue(() => Debug.LogError(TAG + message));
            }
        }
    }

}
